package demo1;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-05-15
 * Time: 7:58
 */
class Car {
    public String status = "off";
    public int speed = 0;
    public void start() {
        this.status = "on";
    }
    public void stop() {
        if(speed == 0) {
            status = "off";
        }
    }
    public void speedUp() {
        if(status == "on" && speed <= 150) {
            speed += 10;
        }
    }
    public void slowDown() {
        if(status == "on" && speed >= 10) {
            speed -= 10;
        }
    }
}
class Line {
    public Point point1;
    public Point point2;
    public Line(Point p1, Point p2) {
        point1 = p1;
        point2 = p2;
    }

    public double getLength() {

        return Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2));
    }
}
class Point {
    public double x;
    public double y;

    public Point(double x1, double y2) {
        x = x1;
        y = y2;
    }
}
class Student {
    private String name;
    private int sex;
    private int age;
    private static int maleCount;
    private static int femaleCount;
    public Student(String name, int sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        if(sex == 0) {
            femaleCount++;
        } else {
            maleCount++;
        }
    }
    public static int getMaleCount() {
        return maleCount;
    }
    public static int getFemaleCount() {
        return femaleCount;
    }
}
class BankAccount {
    private int balance;
    public BankAccount() {
        balance = 0;
    }
    public BankAccount(int balance) {
        this.balance = balance;
    }
    public int getBlance() {
        return balance;
    }
    public void withdraw(int amount) {
        balance -= amount;
    }
    public void deposit(int amount) {
        balance += amount;
    }
}
class WuMingFen {
    public String theMa;
    public int quantity;
    public boolean likeSoup;

    public WuMingFen(String theMa, int quantity, boolean likeSoup) {
        this.theMa = theMa;
        this.quantity = quantity;
        this.likeSoup = likeSoup;
    }

    public WuMingFen(String theMa, int quantity) {
        this.theMa = theMa;
        this.quantity = quantity;
    }

    public WuMingFen() {
        this.theMa = "酸辣";
        this.quantity = 2;
        this.likeSoup = true;
    }
    public void check() {
        System.out.println("面码：" + theMa + "，粉的份量：" + quantity + "两，是否带汤：" + likeSoup);
    }
}
public class Experiment {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String theMa = sc.next();
        int quantity = sc.nextInt();
        boolean likeSoup = sc.nextBoolean();

        //使用三个参数的构造方法创建WuMingFen对象  取名 f1
        WuMingFen wuMingFen1 = new WuMingFen(theMa, quantity, likeSoup);
        //使用两个参数的构造方法创建WuMingFen对象  取名 f2
        WuMingFen wuMingFen2 = new WuMingFen(theMa, quantity);
        //使用无参构造方法创建WuMingFen对象  取名 f3
        WuMingFen wuMingFen3 = new WuMingFen();
        //分别调用三个类的 check方法
        wuMingFen1.check();
        wuMingFen2.check();
        wuMingFen3.check();

        /********** End **********/
    }

    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        BankAccount account = new BankAccount(scanner.nextInt());
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            int m = scanner.nextInt();
            int amount = scanner.nextInt();
            if(m == 1) {
                account.deposit(amount);
            } else if(m == 2){
                account.withdraw(amount);
            }
            System.out.println(account.getBlance());
        }
    }
    public static void main3(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i=0;i<n;i++){
            Student s = new Student(sc.next(),sc.nextInt(), sc.nextInt());
        }
        System.out.println("number of male students:" + Student.getMaleCount() );
        System.out.println("number of female students:" + Student.getFemaleCount() );
    }
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        Point p1 = new Point(sc.nextDouble(),sc.nextDouble());
        Point p2 = new Point(sc.nextDouble(),sc.nextDouble());
        Line l = new Line(p1,p2);
        System.out.printf("%.2f",l.getLength());
    }
    public static void main1(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        Car c = new Car();
        for (int i=0;i<n;i++) {
            int a = s.nextInt();
            switch (a) {
                case 1: c.start(); break;
                case 2: c.stop(); break;
                case 3: c.speedUp(); break;
                case 4: c.slowDown(); break;
            }
        }
        System.out.print(c.status + " ");
        System.out.println(c.speed);
    }
}
